//package com.yang.frost.blueberry.shiro;
//
//import com.yang.frost.blueberry.shiro.filter.JwtFilter;
//import com.yang.frost.blueberry.shiro.filter.ShiroFilterChainManager;
//import org.apache.shiro.SecurityUtils;
//import org.apache.shiro.mgt.*;
//import org.apache.shiro.mgt.SecurityManager;
//import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
//import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
//import org.apache.shiro.web.mgt.DefaultWebSessionStorageEvaluator;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.servlet.Filter;
//import java.util.LinkedHashMap;
//import java.util.Map;
//
///**
// * @author 10296
// * @date 2021/1/25
// * @Description: Shiro 配置
// */
//@Configuration
//public class ShiroConfig {
//
//    /*JWT 过滤器*/
//    private static final String JWT_FILTER_NAME = "jwtFilter";
//    @Autowired
//    private ShiroFilterChainManager filterChainManager;
//
//    @Bean
//    public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
//        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
//        shiroFilterFactoryBean.setSecurityManager(securityManager);
//        Map<String, Filter> filterMap = getFilterMap();
//        shiroFilterFactoryBean.setFilters(filterMap);
//
//
//        return null;
//    }
//
//    /**
//     * 获取filter map
//     *
//     * @return map
//     */
//    private Map<String, Filter> getFilterMap() {
//
//        Map<String, Filter> filterMap = new LinkedHashMap<>();
//        filterMap.put(JWT_FILTER_NAME, new JwtFilter());
//        return filterMap;
//
//    }
//
//    /**
//     * 安全管理配置
//     *
//     * @return
//     */
//    @Bean
//    public SecurityManager securityManager() {
//        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
//        securityManager.setRealm(null);
//        securityManager.setSubjectDAO(subjectDAO());
//        SecurityUtils.setSecurityManager(securityManager);
//
//        return securityManager;
//    }
//
//    @Bean
//    public DefaultSubjectDAO subjectDAO() {
//        DefaultSubjectDAO defaultSubjectDAO = new DefaultSubjectDAO();
//        defaultSubjectDAO.setSessionStorageEvaluator(sessionStorageEvaluator());
//        return defaultSubjectDAO;
//    }
//
//    @Bean
//    public SessionStorageEvaluator sessionStorageEvaluator() {
//        DefaultSessionStorageEvaluator sessionStorageEvaluator = new DefaultWebSessionStorageEvaluator();
//        sessionStorageEvaluator.setSessionStorageEnabled(false);
//        return sessionStorageEvaluator;
//    }
//
//}
